import { Module, forwardRef } from '@nestjs/common';
import { MongooseModule } from '@nestjs/mongoose';
import { VersionControlService } from './version-control.service';
import { VersionControlController } from './version-control.controller';
import { LcDocumentSchema, LcProjectSchema } from '../types/editor.schema';
import { TypeSchema } from '../../superType/types/schemas/type.schema';
import {
  LcCommitSchema,
  LcFileSnapshotSchema,
  ProjectVersionStateSchema,
  LcFileChangeSchema,
} from '../types/commit.schema';
import { ITypeEntity } from '../../superType/types/type/superType.type';
import { EditorModule } from './editor.module';

@Module({
  imports: [
    MongooseModule.forFeature([
      // 版本控制相关 Schema
      { name: 'LcCommit', schema: LcCommitSchema },
      { name: 'LcFileSnapshot', schema: LcFileSnapshotSchema },
      { name: 'ProjectVersionState', schema: ProjectVersionStateSchema },
      { name: 'LcFileChange', schema: LcFileChangeSchema },
      // 编辑器相关 Schema
      { name: 'project', schema: LcProjectSchema },
      { name: 'doc', schema: LcDocumentSchema },
      { name: 'type', schema: TypeSchema },
    ]),
    forwardRef(() => EditorModule), // 需要注入 EditorService
  ],
  providers: [VersionControlService],
  controllers: [VersionControlController],
  exports: [VersionControlService],
})
export class VersionControlModule {}